// Operator Overloading with friend func
#include <iostream>
using namespace std;

class Complex
{
    private:
        int x, y;
    public:
        void setData(int a, int b)
        {
            x=a; y=b;
        }
        void getData()
        {
            cout << x << " " << y << endl;
        }
        friend Complex operator +(Complex, Complex);
};

Complex operator +(Complex X, Complex Y)
{
    Complex temp;
    temp.x = X.x + Y.x;
    temp.y = X.y + Y.y;
    return temp;
}

int main()
{
    Complex o1, o2, o3;
    o1.setData(5, 8);
    o2.setData(7, 9);
    o3 = o1 + o2;
    o3.getData();
}